<?php

/**
 * WeEngine System
 *
 * (c) We7Team 2021 <https://www.w7.cc>
 *
 * This is not a free software
 * Using it under the license terms
 * visited https://www.w7.cc for more details
 */

namespace W7\Addons\demo_engine_pc\Upgrade100;

use W7\Sdk\OpenCloud\Contracts\ModuleUpgradeInterface;

class Up implements ModuleUpgradeInterface
{
    public function database(): array
    {
        $sql[] = <<<EOF
CREATE TABLE IF NOT EXISTS `ims_w7_demo_engine_pc_news` (
  `id` int(10) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
  `title` varchar(60) COLLATE utf8mb4_general_ci NOT NULL COMMENT '新闻标题',
  `description` varchar(300) COLLATE utf8mb4_general_ci NOT NULL COMMENT '新闻简介',
  `label` varchar(30) COLLATE utf8mb4_general_ci NOT NULL,
  `content` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '新闻内容',
  `create_time` datetime NOT NULL COMMENT '创建时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='新闻表';
EOF;
        return $sql;
    }
    
    public function script(): bool
    {
        return true;
    }
}
